<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="js/jquery-2.1.0.js"></script>

    <script th:inline="javascript">
        $(function () {
            var _ctx = [[${application.ctx}]];
            alert("Project ContextPath:" + _ctx);
            alert("路径:" + $("#ctx").val());
        });
    </script>
    <title>Thymeleaf</title>
</head>
<body>
<!-- Project ContextPath -->
<input type="hidden" id="ctx" th:value="${application.ctx}"/> Hello,
<span th:text="${name}"/>!
<br/> Hello,
<span th:text="${query}"/>!
<br/> Hello,
<span th:text="${submit}"/>!
<br/>
<a th:href="@{/query?name=a_href}"> query</a>
<br/>
<form th:action="@{/submit}">
    <input type="text" name="name"/>
    <button type="submit">submit</button>
</form>

</body>
</html>